#import <Foundation/Foundation.h>
#import "SFUDirectorySource.h"
#import "PersistentDataCollection.h"
#import "BusDirectoryDelegate.h"
#import "GraphicsUtilities.h"

/**
 * An DirectoryCacheOperation is an object representing a single operation
 * of downloading and parsing contacts from a SFU directory website.
 *
 * @author      James Lin
 * @version     1.1.2
 * @since       1.0.5
 */
@interface DirectoryCacheOperation : NSOperation <SFUConnectionDelegate> {
	id<BusDirectoryDelegate>  delegate;          // Delegate handling directory events
	PersistentDataCollection* targetCollection;  // Collection in which to store data
	SFUDirectorySource*       directorySource;   // The SFU directory web source
	BOOL                      executing;         // Whether the operation is executing
	BOOL                      finished;          // Whether the operation has finished
}

@property (readonly) BOOL isExecuting;
@property (readonly) BOOL isFinished;

/**
 * Initialize the directory caching operation.
 *
 * @param target       the target collection in which to store cached results
 * @param theDelegate  the delegate to handle directory operation events
 * @return             the initialized DirectoryCacheOperation
 */
- (id)initWithTargetCollection:(PersistentDataCollection*)target 
					  delegate:(id<BusDirectoryDelegate>)theDelegate;

@end
